<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<!--suppress MybatisGenerateCustomPluginInspection -->
<generatorConfiguration>
    <context id="MysqlContext" targetRuntime="com.zxkj.ssm.weixin.shop.mybatis.generator.plugins.MapperSuffixWildcardIntrospectedTable" defaultModelType="flat">
        <property name="javaFileEncoding" value="UTF-8"/>
        <property name="useMapperCommentGenerator" value="false"/>
        <!-- 由于beginningDelimiter和endingDelimiter的默认值为双引号(")，在Mysql中不能这么写，所以还要将这两个默认值改为`  -->
        <property name="beginningDelimiter" value="`"/>
        <property name="endingDelimiter" value="`"/>

        <!-- 为生成的Java模型创建一个toString方法 -->
        <plugin type="org.mybatis.generator.plugins.ToStringPlugin"></plugin>

        <!-- 为生成的Java模型类添加序列化接口，并生成serialVersionUID字段 -->
        <plugin type="com.zxkj.ssm.weixin.shop.mybatis.generator.plugins.SerializablePlugin">
            <property name="suppressJavaInterface" value="false"/>
        </plugin>


        <!-- 生成在XML中的<cache>元素 -->
        <plugin type="org.mybatis.generator.plugins.CachePlugin">
            <property name="cache_type" value="org.mybatis.caches.ehcache.LoggingEhcache" />
        </plugin>

        <!-- Java模型生成equals和hashcode方法 -->
        <plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"></plugin>

        <!-- 生成的代码去掉注释 -->
        <commentGenerator type="com.zxkj.ssm.weixin.shop.mybatis.generator.plugins.CommentGenerator">
            <property name="suppressAllComments" value="true" />
            <property name="suppressDate" value="true"/>
        </commentGenerator>

        <!-- 数据库连接 -->
        <jdbcConnection driverClass="${jdbcDriver}"
                        connectionURL="${jdbcUrl}"
                        userId="${jdbcUsername}"
                        password="${jdbcPassword}">
        </jdbcConnection>

        <!--MyBatis 生成器只需要生成 Model-->
        <javaModelGenerator targetPackage="${mybatisEntity}" targetProject="${targetProject}/src/main/java">
            <property name="rootClass" value="com.zxkj.ssm.weixin.shop.model.PagerModel"/>
        </javaModelGenerator>

        <!-- MapperXML生成 -->
        <sqlMapGenerator targetPackage="${mybatisMapperSqlXml}" targetProject="${targetProject_sqlMap}/src/main/java" />

        <!-- Mapper接口生成 -->

         <javaClientGenerator targetPackage="${mybatisMapper}" targetProject="${targetProject}/src/main/java" type="XMLMAPPER">
            <property name="rootInterface" value="com.zxkj.ssm.weixin.shop.basic.BasicDao"/>
        </javaClientGenerator>

        <!-- 需要映射的表 -->
        <#list tables as table>
            <table tableName="${table.table_name}" domainObjectName="${table.model_name}" mapperName="{0}MapperDao"></table>
        </#list>
    </context>
</generatorConfiguration>